﻿Ext.define('I2R.view.singleproposal', {
    extend: 'Ext.Panel',
    alias: 'widget.i2rsingleproposal',
    border: false,
    bodyCls: 'padd-up',
    autoScroll: true,
    tbar: [
                {
                    xtype: 'button',
                    iconCls: 'icon_disk',
                    text: 'Save draft',
                    action: 'save-draft'
                },
                {
                    xtype: 'button',
                    iconCls: 'icon_email-go',
                    text: 'Save and submit for review',
                    action: 'save-submit'
                }
    ],
    items: [
        {
            xtype: 'form',
            id: 'singleproposalform',
            border: false,
            bodyCls: 'padd-up',
            fieldDefaults: {
                labelAlign: 'left',
                labelWidth: 200,
                labelSeparator: ''
            },
            items: [
                {
                    xtype: 'panel',
                    title: 'Anonymous or named',
                    bodyCls: 'padd-up',
                    layout: 'anchor',
                    cls: 'margin10-below',
                    items: [
                        { fieldLabel: 'DeviationId', name: 'Id', id: 'deviationId', readOnly: true, xtype: 'textfield'},
                        { fieldLabel: 'My name<br /><span class="small">Choose between an anonymous or named deviation</span>', xtype: 'textfield', name: 'MyNames', value: usersFullname, readOnly: true, anchor: '-100' },
                        { fieldLabel: '&nbsp;', boxLabel: 'Anonymous', xtype: 'checkbox', name: 'Anonymous', allowBlank: false }
                        ]
                },
                {
                    xtype: 'panel',
                    title: 'The deviation',
                    bodyCls: 'padd-up',
                    layout: 'anchor',
                    cls: 'margin10-below',
                    items: [
                        { fieldLabel: 'Subject<br /><span class="small">The name of your deviation</span>', xtype: 'textfield', name: 'Subject', allowBlank: false, anchor: '-100' },
                        { fieldLabel: 'Observation/Problem to solve<br /><span class="small">Your observation or problem this deviation is about.</span>', xtype: 'textarea', name: 'ProblemToSolve', allowBlank: false, anchor: '-100', height: 300 },
                        { fieldLabel: 'My proposal/solution<br /><span class="small">Describe potential solution</span>', xtype: 'textarea', name: 'MySolution', allowBlank: false, anchor: '-100', height: 300 }
                        ]
                },
                {
                    xtype: 'panel',
                    title: 'Attachments',
                    bodyCls: 'padd-up',
                    cls: 'margin10-below',
                    items: [
                        { fieldLabel: 'File<br /><span class="small">Attach files, like calculations or other necessary documents.</span>', xtype: 'filefield', name: 'Files' }
                        , { xtype: 'button', text: 'Upload', action: 'upload-files', hidden: true},
                        { xtype: 'panel', id: 'uploadedfile-container', border: false}
                        ]
                },
                {
                    xtype: 'hiddenfield',
                    id: 'uploadedfiles',
                    name: 'uploadedfiles'
                },
                {
                    xtype: 'panel',
                    bodyCls: 'padd-up',
                    cls: 'margin10-below',
                    border: false
                }
            ]
        }
    ]
});